const connection = require('../app/database');

class VerifyCodeService {
  async getVerifyCode(code) {
    const statement = `
      UPDATE code SET code = ?;
    `;
    const [result] = await connection.execute(statement, [code]);
    console.log('[verifyCode.service]获取验证码', result);
    return result;
  }

  async verifyCode(code) {
    const statement = `
      SELECT * FROM code WHERE code = ?;
    `;
    const [result] = await connection.execute(statement, [code]);
    console.log('[verifyCode.service]验证验证码', result);
    return result;
  }
}

module.exports = new VerifyCodeService();